/**
    ==================================================================================================
**    date: 2007.8.28
**    author: kevin
**    description: checkBox
**  ==================================================================================================
**/
	//对checkBox全选的操作方法
	function allChecked(id){
		var spanObj = document.getElementById(id);
		var checkedbox= spanObj.getElementsByTagName("input");

	  	for(var i=1;i<checkedbox.length;i++){

		  if(checkedbox[0].checked == true ){
			checkedbox[i].checked = true;
		  }else{
			checkedbox[i].checked = false;
		  }

	 	}

	}

	//在全选状态下取消一个则取消全选项
	function deleteAllChecked(id){
		var spanObj = document.getElementById(id);
		var checkedbox= spanObj.getElementsByTagName("input");

		if(checkedbox[0].checked){
			checkedbox[0].checked = false;
		}
		var k = 0;
		var m = checkedbox.length;
		for(var i=1;i<m;i++){
		  if(checkedbox[i].checked){
			k++;
		  }else{
		  	k--;
		  }
	    }
		if(k == m-1){
			checkedbox[0].checked = true;
		}
	}

	//验证选中的个数不能超出设定的个数
	function checkAll(id,num){
	  var spanObj = document.getElementById(id);
	  var checkedbox= spanObj.getElementsByTagName("input");
	  if(checkedbox[0].checked){//禁用全选项
			checkedbox[0].checked = false;
	  }
	  var j=0;
	  for(var i=1;i<checkedbox.length;i++){
		  if(checkedbox[i].checked){
			if(j<=num){
				j++;
			}else{
				j--;
			}
		  }
	  }
	 if(j>=num){
		  alert("只能同时处理"+num+"个选项！");
		  for(var i=1;i<checkedbox.length;i++){

			  if(checkedbox[i].checked==false){
				checkedbox[i].disabled=true;
			  }
		   }
	   }else{
		  for(var i=1;i<checkedbox.length;i++){

			  if(checkedbox[i].checked==false){
				checkedbox[i].disabled=false;
			   }
		   }
	  }
  	}





